import { autoTracker, tracker } from "./action"
import { onVueRouter, pageChange, pageStayTime, pv } from "./behavior"
import { setConfig } from "./config"
import error from "./error"
import performance from "./performance"

const monitor = {
  init(option = {}) {
    console.log('=== monitor init ===')
    setConfig(option)
    error() // 错误监听处理
    performance() // 性能监控
    autoTracker() // 用户行为监听
    pv()  // 单日访问量
    api() // api远程请求数据采集
  },
  tracker, // 记录: ['click', 'keydown', 'blur', 'focus', 'touchstart', 'touchend']
  pageStayTime, // 页面停留时间
  pageChange, // 页面跳转记录
  onVueRouter, // vue 路由发生变化时记录
}

export default monitor